# Copyright 2019 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Generates source files with embedded file contents.

load(":build_defs.bzl", "iree_c_embed_data")

package(
    default_visibility = ["//visibility:public"],
    features = ["layering_check"],
    licenses = ["notice"],  # Apache 2.0
)

cc_binary(
    name = "iree-c-embed-data",
    srcs = ["iree-c-embed-data-main.cc"],
)

iree_c_embed_data(
    name = "testembed1",
    # do not sort
    srcs = [
        "file1.bin",
        "data/file2.bin",
    ],
    c_file_output = "testembed1.c",
    flatten = True,
    h_file_output = "testembed1.h",
)

iree_c_embed_data(
    name = "testembed2",
    srcs = [
        "data/file3.bin",
    ],
    c_file_output = "testembed2.c",
    flatten = True,
    h_file_output = "testembed2.h",
)

cc_test(
    name = "iree_c_embed_data_test",
    srcs = ["iree_c_embed_data_test.cc"],
    deps = [
        ":testembed1",
        ":testembed2",
        "//runtime/src/iree/testing:gtest",
        "//runtime/src/iree/testing:gtest_main",
    ],
)
